<template>
	<view class="container">
		<!-- 搜索 -->
		<view class="search-bar">
			<view class="search-icon">
				<uni-icons type="search" size="24" color="#999"></uni-icons>
			</view>
			<input placeholder="钓点" />
			<view class="location" @click="cityselect">
				<uni-icons type="location-filled" size="24" color="#999"></uni-icons>
				{{city.name}}
			</view>
		</view>

		<view class="tabs">
			<view v-for="(tab, index) in tabs" :key="index" class="tab" :class="{ active: activeIndex === index }"
				@click="handleTabClick(index)">
				{{ tab.label }}
			</view>
		</view>

		<!-- 用户视频 -->
		<view class="video">
			<scroll-view :scroll-top="scrollTop" scroll-y="true" class="scroll-Y"
				>

				<view class="itemlist">
					<view class="item">
						<view class="image-content">
							<image class="image-item" mode="aspectFit" src="@/static/鱼2.webp"></image>
							<uni-rate size="15" :value="5" class="rate" />
						</view>
						<view class="user-info">
							<view class="avatar">
								<image class="user-avatar" src="@/static/头像.jpg" alt="用户头像"></image>
								<text class="username">一杯热水</text>
							</view>
							<view class="user-details">
								<text class="distance">66.48km</text>
								<text class="location">石家庄市 行唐县</text>
							</view>
						</view>
					</view>
					<view class="item_two item">
						<view class="image-content">
							<image class="image-item" mode="aspectFit" src="@/static/鱼1.jpg"></image>
							<uni-rate size="15" :value="3" class="rate" />
						</view>
						<view class="user-info">
							<view class="avatar">
								<image class="user-avatar" src="@/static/头像.jpg" alt="用户头像"></image>
								<text class="username">一杯热水</text>
							</view>
							<view class="user-details">
								<text class="distance">66.48km</text>
								<text class="location">石家庄市 行唐县</text>
							</view>
						</view>
					</view>
				</view>
				
				
				<view class="itemlist">
					<view class="item">
						<view class="image-content">
							<image class="image-item" mode="aspectFit" src="@/static/鱼2.webp"></image>
							<uni-rate size="15" :value="5" class="rate" />
						</view>
						<view class="user-info">
							<view class="avatar">
								<image class="user-avatar" src="@/static/头像.jpg" alt="用户头像"></image>
								<text class="username">一杯热水</text>
							</view>
							<view class="user-details">
								<text class="distance">66.48km</text>
								<text class="location">石家庄市 行唐县</text>
							</view>
						</view>
					</view>
					<view class="item_two item">
						<view class="image-content">
							<image class="image-item" mode="aspectFit" src="@/static/鱼1.jpg"></image>
							<uni-rate size="15" :value="3" class="rate" />
						</view>
						<view class="user-info">
							<view class="avatar">
								<image class="user-avatar" src="@/static/头像.jpg" alt="用户头像"></image>
								<text class="username">一杯热水</text>
							</view>
							<view class="user-details">
								<text class="distance">66.48km</text>
								<text class="location">石家庄市 行唐县</text>
							</view>
						</view>
					</view>
				</view>
			</scroll-view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: "Hello",
				city: {
					code: "",
					name: ""
				},
				hotCity: [{
						code: "110100",
						name: "北京"
					},
					{
						code: "310100",
						name: "上海"
					},
					{
						code: "330100",
						name: "杭州"
					},
					{
						code: "440100",
						name: "广州"
					},
					{
						code: "440300",
						name: "深圳"
					},
					{
						code: "320100",
						name: "南京"
					},
					{
						code: "500100",
						name: "重庆"
					},
					{
						code: "510100",
						name: "成都"
					}
				],
				activeIndex: 0,
				tabs: [{
						label: "最新发布"
					},
					{
						label: "热门钓点"
					},
					{
						label: "离我最近"
					},
					{
						label: "我的收藏"
					},
				],
			};
		},
		onLoad() {},
		methods: {
			handleTabClick(index) {
				this.activeIndex = index;
			},
			cityselect() {
				this.$refs.citySelect.open();
			},
			// 点击城市选项
			select(city) {
				this.city = city;
			},
		},
	};
</script>

<style scoped lang="scss">
	.container {
		height: 100vh;
		background: linear-gradient(to bottom, #ff580b, #e67474);
		display: flex;
		flex-direction: column;
	}

	.user-info {
		height: 55px;
		display: flex;
		flex-direction: row;
		background-color: #fff;
		border-radius: 0 0 10px 10px;
	}

	.avatar {
		margin-left: 5px;
		display: flex;
		align-items: center;
	}

	.user-avatar {
		width: 30px;
		height: 30px;
		border-radius: 50%;
	}

	.user-details {
		font-size: 10px;
		display: flex;
		flex-direction: column;
		justify-content: center;
		margin-left: auto;
		text-align: right;
		padding-right: 10px;

		.location {
			padding-top: 15px;
		}
	}

	.username {
		font-size: 12px;
	}

	.video {
		flex-grow: 1;
		overflow: hidden;
	}

	.scroll-Y {
		height: 100%;
	}

	.itemlist {
		display: flex;
		justify-content: center;
		margin-bottom: 10px;
	}

	.item {
		height: 280px;
		width: 170px;
		border: 1px solid #ccc;
		border-radius: 10px;
	}

	.image-item {
		height: 225px;
		width: 170px;
		border-radius: 10px 10px 0 0;
	}

	.image-content {
		position: relative;
	}

	.rate {
		position: absolute;
		right: 5px;
		bottom: 5px;
		background-color: rgba(0, 0, 0, 0.3);
		border-radius: 10px;
		padding: 2px;
	}

	.item_two {
		margin-left: 15px;
	}

	.tabs {
		display: flex;
		justify-content: space-around;
		margin-bottom: 20px;
		margin-top: 10px;

		.tab {
			font-size: 15px;
			color: #000;
			border: 1px solid #ccc;
			border-radius: 30px;
			padding: 4px 8px;
		}

		.active {
			font-weight: bold;
			color: #fff;
			border-color: #fff;
		}
	}

	.search-bar {
		display: flex;
		align-items: center;
		justify-content: center;
		background-color: #fff;
		border-radius: 10px;
		padding: 10px 20px;
		width: 85%;
		height: 21px;
		margin: 0 auto;

		.search-icon {
			margin-right: 5px;
			margin-top: 4px;
		}

		input {
			flex: 1;
			font-size: 16px;
			color: #333;
			border: none;
			outline: none;
			background: transparent;
		}

		.location {
			display: flex;
			align-items: center;
			font-size: 16px;
			color: #333;
			margin-left: 20px;
		}
	}
</style>